﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Clotho.UI {
	public partial class Guide : Form {
		public Guide() {
			InitializeComponent();
		}
		int novel_count = 0;
		private void CreateBTN_Click(object sender, EventArgs e) {
			MainForm form = new MainForm(this);
			showForm(form);
		}

		private void showForm(MainForm form) {
			form.Show();
			form.FormClosed += Form_FormClosed;
			novel_count++;
			this.Hide();
		}

		private void Form_FormClosed(object sender, FormClosedEventArgs e) {
			novel_count--;
			if(novel_count == 0) {
				this.Show();
			}
		}

		private void OpenBTN_Click(object sender, EventArgs e) {
			this.mainOPEN.ShowDialog();
		}

		private void mainOPEN_FileOk(object sender, CancelEventArgs e) {
			MainForm form = new MainForm(this, mainOPEN.FileName);
			showForm(form);
		}
	}
}
